//
//  XTCellForeveryone.m
//  TTLestening
//
//  Created by dllo on 16/3/22.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "XTCellForeveryone.h"
#import "XTCellofCellForeveryone.h"

#define HEIGHT  [UIScreen mainScreen].bounds.size.height

@interface XTCellForeveryone ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,retain)UITableView *tableivew;

@property (nonatomic,retain)NSArray *arrayshuju;

@end

@implementation XTCellForeveryone

//-(instancetype)initWithFrame:(CGRect)frame{
//    
//    self = [super initWithFrame:frame];
//    if (self) {
//        self.contentView.backgroundColor = [UIColor redColor];
//        
////        self.tableivew = [[UITableView alloc]initWithFrame:frame style:UITableViewStyleGrouped];
////        [self.contentView addSubview:self.tableivew];
////        
////        self.tableivew.delegate =self;
////        self.tableivew.dataSource = self;
////        
//////        self.tableivew.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
////     
////        
////        NSLog(@"asdad");
////        
////        UINib *nibCell = [UINib nibWithNibName:@"XTCellofCellForeveryone" bundle:[NSBundle mainBundle]];
////        [self.tableivew registerNib:nibCell forCellReuseIdentifier:@"pool1"];
//
//            }
//    
//    
//    
//    
//    return self;
//}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self createTable];
        
    }
    
    return self;

}

- (void) createTable {

    self.tableivew = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain];
    [self.contentView addSubview:self.tableivew];
    
    self.tableivew.delegate =self;
    self.tableivew.dataSource = self;
    
    self.tableivew.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
    
    
    self.tableivew.scrollEnabled =NO; //设置tableview 不能滚动
    NSLog(@"asdad");
    
    UINib *nibCell = [UINib nibWithNibName:@"XTCellofCellForeveryone" bundle:[NSBundle mainBundle]];
    [self.tableivew registerNib:nibCell forCellReuseIdentifier:@"pool1"];


}
- (void)layoutSubviews {

    [super layoutSubviews];
    
    self.tableivew.frame = self.contentView.frame;

}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
//    return self.arrayshuju.count;
    return 3;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return HEIGHT / 10;
    
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    XTCellofCellForeveryone *cell = [tableView dequeueReusableCellWithIdentifier:@"pool1"];
    
    cell.backgroundColor = [UIColor brownColor];
    
    return cell;
}



-(void)moreMusic:(UIButton *)buuton{
    
    NSLog(@"更多音乐");

}
- (void)awakeFromNib {
    // Initialization code
}




- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
